#include "sylar/http/http_server.h"
#include "sylar/log.h"

sylar::Logger::ptr g_logger = SYLAR_LOG_ROOT();

void run(){
	sylar::Address::ptr addr = sylar::Address::LookupAnyIPAddress("0.0.0.0:80");
	if(!addr){
		SYLAR_LOG_ERROR(g_logger) << "get address error";
	}
	sylar::http::HttpServer::ptr http_server(new sylar::http::HttpServer);
	while(!http_server->bind(addr)){
		SYLAR_LOG_ERROR(g_logger) << "bind " << *addr << " error";
		sleep(1);
	}
	http_server->start();
}

int main(int argc, char **argv){
	sylar::IOManager iom(3, true, "serv");
	iom.schedule(run);
	return 0;
}